import { post } from "./request";
// 导入加密算法
import axios from "axios";

// 返回上一页
export const onClickLeft = () => history.back();

// 处理表单格式 时间
export const datetime = (val) => {
    if (!val) {
        return
    }
    let myDate = new Date(val)
    return myDate.getFullYear()
        + "-" + (myDate.getMonth() + 1)
        + "-" + myDate.getDate()
        + " " + myDate.getHours()
        + ":" + myDate.getMinutes()
        + ":" + myDate.getSeconds()
};



// 上传图片
export function req_upload_img(data) {
    return new Promise((resolve, reject) => {
        axios.post("http://upload-z2.qiniup.com", data).then((resp) => {
            resolve(resp);
        }).catch((err) => {
            reject(err)
        });
    });
}

